<?php

class myUser extends sfGuardSecurityUser
{
	 /**
   * Returns true if user is authenticated.
   *
   * @return boolean
  */ 
  public function isAuthenticated()
  {
    if (!$this->authenticated)
    {      
      if ($cookie = sfContext::getInstance()->getRequest()->getCookie(sfConfig::get('app_sf_guard_plugin_remember_cookie_name', 'sfRemember')))
      {
        $c = new Criteria();
        $c->add(sfGuardRememberKeyPeer::REMEMBER_KEY, $cookie);
        $rk = sfGuardRememberKeyPeer::doSelectOne($c);
        if ($rk && $rk->getSfGuardUser())
        {
          $this->signIn($rk->getSfGuardUser());
        }
      }
    }
    
    return $this->authenticated;
  }
	
}
